Skip to content

[Win32] Fix tree tooltips for reordered columns#3366

Open
HeikoKlare wants to merge 1 commit into
eclipse-platform:masterfrom
HeikoKlare:table-tooltip-column-order
Open

[Win32] Fix tree tooltips for reordered columns#3366
HeikoKlare wants to merge 1 commit into
eclipse-platform:masterfrom
HeikoKlare:table-tooltip-column-order

Conversation

@HeikoKlare
Copy link
Copy Markdown
Contributor

@HeikoKlare HeikoKlare commented Jun 5, 2026

When reordering columns of a tree control, wrong tooltips are shown when hovering over a cell that is too small to show the full content. Instead of the content of the actual cell at that place, the one of the cell that was originally placed at that position (without column reordering) is shown.

This change corrects the index used for retrieving the tooltip content by considering the column order.

Found when working on:

How to test

For example with the following snippet:

public static void main (String [] args) {
	Display display = new Display ();
	Shell shell = new Shell(display);
	shell.setLayout(new FillLayout());
	Tree t = new Tree (shell, 0);
	t.setHeaderVisible(true);
	t.setLinesVisible(true);
	TreeColumn col1 = new TreeColumn(t, 0);
	col1.setWidth(100);
	col1.setMoveable(true);
	TreeColumn col2 = new TreeColumn(t, 0);
	col2.setWidth(100);
	col2.setMoveable(true);
	new TreeItem (t, 0).setText(new String [] {"First column content", "Second column content"});

	shell.open ();
	while (!shell.isDisposed ()) {
		if (!display.readAndDispatch ()) display.sleep ();
	}
	display.dispose ();
}

When reordering the two columns, you see the following results:

Without the change:
image

With the change:
image

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Jun 5, 2026

Test Results (win32)

   30 files  ±0     30 suites  ±0   4m 37s ⏱️ - 1m 7s
4 704 tests ±0  4 629 ✅ ±0  75 💤 ±0  0 ❌ ±0 
1 234 runs  ±0  1 210 ✅ ±0  24 💤 ±0  0 ❌ ±0 

Results for commit 4f1a302. ± Comparison against base commit c42bbab.

♻️ This comment has been updated with latest results.

@HeikoKlare HeikoKlare marked this pull request as ready for review June 5, 2026 16:18
@HeikoKlare HeikoKlare requested a review from Copilot June 6, 2026 07:10
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Fixes incorrect Win32 Tree in-place tooltip text when columns are reordered, by mapping the hovered visual column index to the underlying creation column index before retrieving the cell text.

Changes:

  • Use getColumnOrder() to translate the hit-tested column position into the correct model/creation index for tooltip text lookup.
  • Update tooltip text retrieval to use the mapped index for non-first columns.

Comment thread bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Tree.java Outdated
Comment thread bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Tree.java Outdated
@HeikoKlare HeikoKlare changed the title [Win32] Fix table tooltips for reordered columns [Win32] Fix tree tooltips for reordered columns Jun 6, 2026
When reordering columns of a tree control, wrong tooltips are shown
when hovering over a cell that is too small to show the full content.
Instead of the content of the actual cell at that place, the one of the
cell that was originally placed at that position (without column
reordering) is shown.

This change corrects the index used for retrieving the tooltip content
by considering the column order.
@HeikoKlare HeikoKlare force-pushed the table-tooltip-column-order branch from 09515ab to 4f1a302 Compare June 6, 2026 07:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants